package com.bilin.coin.activity;

import android.view.View;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.bilin.coin.R;
import com.bilin.coin.bean.CoinRecordBean;
import com.bilin.coin.common.base.BaseAppCompatActivity;

import java.math.BigDecimal;

import butterknife.BindView;
import butterknife.OnClick;

@Route(path = "/order/WithdrawCoinDetailActivity")
public class WithdrawCoinDetailActivity extends BaseAppCompatActivity {

    @Autowired
    CoinRecordBean.RecordsBean item;
    @Autowired
    String coinName;

    @BindView(R.id.tv_amount)
    TextView tv_amount;
    @BindView(R.id.tv_hash)
    TextView tv_hash;
    @BindView(R.id.tv_address)
    TextView tv_address;
    @BindView(R.id.tv_status)
    TextView tv_status;
    @BindView(R.id.tv_time)
    TextView tv_time;
    @BindView(R.id.tv_fee)
    TextView tv_fee;
    @BindView(R.id.tv_coin_title)
    TextView tv_coin_title;

    @Override
    protected void initView() {
        setTitle("提"+coinName+"详情");
        tv_coin_title.setText("提"+coinName+"地址");
        fillData();
    }


    private void fillData() {
        if (item != null) {
            tv_amount.setText(new BigDecimal(item.getAmount()).toPlainString());
            tv_hash.setText(item.getHash());
            tv_address.setText(item.getAddress());
            tv_time.setText(item.getCreateTime());
            tv_fee.setText(item.getFees()+"");
            switch (item.getStatus()) {
                case 0:
                    tv_status.setText(getResources().getString(R.string.wait_withdraw));
                    break;
                case 1:
                    tv_status.setText(getResources().getString(R.string.dispose_ing));
                    break;
                case 2:
                    tv_status.setText(getResources().getString(R.string.withdraw_success));
                    break;
                case 3:
                    tv_status.setText(getResources().getString(R.string.cancel_user));
                    break;
                case 4:
                    tv_status.setText(getResources().getString(R.string.cancel_sys));
                    break;
            }
        }
    }

    @OnClick({R.id.tv_copy_hash, R.id.tv_copy_address})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.tv_copy_hash:
                copeClipSuccess(tv_hash);
                break;
            case R.id.tv_copy_address:
                copeClipSuccess(tv_address);
                break;
        }
    }

    @Override
    protected void initData() {

    }


    @Override
    protected int getLayoutId() {
        return R.layout.activity_withdraw_coin_detail;
    }

}
